package com.sunnada.edu.system.pub.filter;

import java.io.IOException;
import java.util.List;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import com.sunnada.edu.system.pub.common.AppContext;

/**
 * explain 系统启动
 * 
 * @author chs 2014-10-16 version 1.0
 */
public class MiniInit implements Filter {

	public void destroy() {
		System.out.println("数据销毁......");
	}

	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
		System.out.println("--------------------request:" + request.getParameter("areaCode"));
		//System.out.println("request:" + request + " response" + response);
	}

	/* 
	      工程启动时单例实例化上下文
	 * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
	 */
	public void init(FilterConfig filterConfig) throws ServletException {
		AppContext act = new AppContext();
		act.setCtx();
		act.setRootPath(filterConfig.getServletContext().getRealPath("/"));
		System.out.println("init.......");
	}

}
